package com.qf.mrmd.controller;

import com.qf.mrmd.result.ResponseDate;
import com.qf.mrmd.service.SubjectService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * (Subject)表控制层
 *
 * @author makejava
 * @since 2021-07-14 14:40:53
 */
@RestController
@RequestMapping("subject")
public class SubjectController {
    /**
     * 服务对象
     */
    @Autowired
    private SubjectService subjectService;
    @ApiOperation(value = "获取推荐美容项目数据",notes = "通过标题获取美容项目列表")
    @GetMapping("/{title}")
    public ResponseDate subjectInfo(@PathVariable String title){
        return subjectService.queryByTitle(title);
    }

    @GetMapping("/one/{id}")
    @ApiOperation(value = "获取美容项目详情", notes = "通过美容项目id获取项目详情")
    @ApiImplicitParam(name = "id", value = "美容项目id", dataType = "Integer")
    public ResponseDate subjectDetail(@PathVariable Integer id) {
        return subjectService.queryById(id);

    }
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public ResponseDate selectOne(Integer id) {
        return this.subjectService.queryById(id);
    }

}
